package com.codingman.jpademo2;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.MapKeyColumn;

@Entity
public class Employee {
	@Id
	private Integer id;
	
	private String name;
	
	private Double salary;

	@ElementCollection
	@CollectionTable(name = "Employee_PHONES", joinColumns = @JoinColumn(name = "Employee_ID"))
	@Column(name = "PHONES")
	private List<String> phones = new ArrayList<String>();
	
	@ElementCollection
	@MapKeyColumn(name = "ADDRESSES_Key")
    @CollectionTable(name = "Employee_ADDRESSES", joinColumns = @JoinColumn(name = "Employee_ID"))
	private Map<String, Address> addresses = new HashMap<String, Address>();
	
	public Map<String, Address> getAddresses() {
		return addresses;
	}

	public void setAddresses(Map<String, Address> addresses) {
		this.addresses = addresses;
	}

	public Employee() {
		
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Double getSalary() {
		return salary;
	}

	public void setSalary(Double salary) {
		this.salary = salary;
	}

	public List<String> getPhones() {
		return phones;
	}

	public void setPhones(List<String> phones) {
		this.phones = phones;
	}
	
}
